<template>
  <div>
    <!-- 面包屑 -->
    <div class="crumbs">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/' }"><i class="el-icon-s-fold"></i> 首页</el-breadcrumb-item>
        <el-breadcrumb-item>商户管理</el-breadcrumb-item>
        <el-breadcrumb-item>商户排名</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <!-- 表单 -->
    <el-card shadow="always">

      <!-- 表格 -->
      <el-table border style="width: 100%" size="medium" :data="tableData">
        <el-table-column type="index" prop="date" label="排名" width="80" align="center">
        </el-table-column>
        <el-table-column prop="name" label="商户名称" align="center">
        </el-table-column>
        <el-table-column prop="address" label="门店地址" align="center">
        </el-table-column>
        <el-table-column prop="director" label="负责人" align="center">

        </el-table-column>
        <el-table-column prop="avg" label="平均星级" align="center">
          <template slot-scope="scope">

            <el-rate :value="scope.row.avg" disabled show-score text-color="#ff9900" score-template="{value}">
            </el-rate>
          </template>
        </el-table-column>


      </el-table>


      <!-- 分页 -->
      <el-pagination style="text-align: center;margin-top: 20px;" :current-page.sync="pageInfo.pageNum"
        :page-sizes="[3, 5, 10, 20]" :page-size.sync="pageInfo.pageSize" layout="prev, pager, next,total,jumper,->, sizes"
        :total="pageInfo.total" @current-change="getMerchantID" @size-change="getMerchantID">
      </el-pagination>

    </el-card>



  </div>
</template>

<script>
export default {
  name:"MerchantPm",
  data() {
    return {
      pageInfo: {
        pageNum: 1,
        pageSize: 3,
        total: 20,
      },
      value: 0,
      tableData: []
    }
  },
  mounted() {
    this.getMerchantID();
  },
  methods: {
    async getMerchantID() {
      let { pageNum, pageSize } = this.pageInfo;
      let res = await this.$API.Merchant.reqMerchantID(pageNum, pageSize);
      if (res.code == 200) {
        this.tableData = res.data.list;
        this.pageInfo.total = res.data.total;
        this.value = res.data.list.avg;
      }
    }

  }
}
</script>

<style scoped></style>